package com.uzai.console.web.reportpanel;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.BaseDto;
import com.uzai.console.dto.reportpanel.ReportPanelFansValueDto;
import com.uzai.console.dto.reportpanel.ReportPanelIdDto;
import com.uzai.console.dto.reportpanel.ReportPanelQuery;
import com.uzai.console.enums.ReportPanelTypeEnum;
import com.uzai.console.service.device.DeviceService;
import com.uzai.console.service.reportpanel.ReportPanelFansValueService;
import com.uzai.console.vo.reportpanel.ReportPanelFansValueVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * 粉丝价值
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "粉丝收益报表面板",tags = "报表面板|粉丝收益")
@ApiSort(50)
@RestController
public class ReportPanelFansValueController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(ReportPanelFansValueController.class);

    @Autowired
    private DeviceService deviceService;
    @Autowired
    private ReportPanelFansValueService reportPanelFansValueService;

    @ApiOperation(value = "分页查询粉丝价值报表面板", notes = "分页查询粉丝价值报表面板", response = ReportPanelFansValueVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/reportPanel/fansValue/findByPage")
    public Object findByPage(@RequestBody ReportPanelQuery reportPanelQuery) {
        reportPanelQuery.setType(ReportPanelTypeEnum.FANS_VALUE.getId());
        return reportPanelFansValueService.findReportPanelFansValueByPage(reportPanelQuery);
    }

    @ApiOperation(value = "根据id查询粉丝价值报表面板详情", notes = "根据id查询粉丝价值报表面板详情", response = ReportPanelFansValueVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/reportPanel/fansValue/findById")
    public Object findById(@RequestBody ReportPanelIdDto reportPanelIdDto) {
        return reportPanelFansValueService.findReportPanelFansValueById(reportPanelIdDto);
    }

    @ApiOperation(value = "添加粉丝价值报表面板", notes = "添加粉丝价值报表面板", response = Boolean.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/reportPanel/fansValue/add")
    public Object add(@RequestBody ReportPanelFansValueDto reportPanelFansValueDto) {
        reportPanelFansValueService.addReportPanelFansValue(reportPanelFansValueDto);
        return true;
    }

    @ApiOperation(value = "修改粉丝价值报表面板", notes = "修改粉丝价值报表面板", response = Boolean.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/reportPanel/fansValue/edit")
    public Object edit(@RequestBody ReportPanelFansValueDto reportPanelFansValueDto) {
        reportPanelFansValueService.editReportPanelFansValue(reportPanelFansValueDto);
        return true;
    }

    @ApiOperation(value = "删除粉丝价值报表面板", notes = "删除粉丝价值报表面板", response = Boolean.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/reportPanel/fansValue/deleteById")
    public Object deleteById(@RequestBody ReportPanelIdDto reportPanelIdDto){
        reportPanelFansValueService.deleteReportPanelFansValueById(reportPanelIdDto);
        return true;
    }

    @ApiOperation(value = "获取粉丝价值报表显示字段列表", notes = "获取粉丝价值报表显示字段列表", response = HashMap.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/reportPanel/fansValue/showFieldList")
    public Object showFieldList(@RequestBody BaseDto baseDto) {
        return reportPanelFansValueService.showFieldList();
    }

}
